home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Tools / Languages / MacHaskell 2.2 / progs / prelude / PreludeArrayPrims.hi < prev    next >
Encoding:
Text File  |  1994-09-27  |  1.3 KB  |  38 lines  |  [TEXT/YHS2]

  1. -- These primitives are used to implement arrays with constant time
  2. -- access.  There are destructive update routines for arrays for use
  3. -- internally in functions such as array.  These are impure but are
  4. -- marked as pure to keep them out of the top level monad.  This should
  5. -- be redone using lambda-var someday.
  6.  
  7. interface PreludeBltinArray where
  8.  
  9. -- Used to represent vectors with delayed components
  10. import PreludeArrayInternal(Vector)
  11. -- An explicit represenation of a delayed object
  12. import PreludeArrayInternal(Delay)  
  13.  
  14. -- Primitive vectors now always have strict components.  This permits us
  15. -- to treat array indexing as an atomic operation without the explicit
  16. -- force on access.
  17.  
  18. primVectorSel :: Vector a -> Int -> a
  19. primVectorUpdate :: Vector a -> Int -> a -> a
  20. primMakeVector :: Int -> a -> Vector a
  21. primCopyVector :: Vector a -> Vector a
  22.  
  23. -- These functions are used for explicit sequencing of destructive ops
  24.  
  25. strict1 :: a -> b -> b
  26. primForce :: Delay a -> a
  27.  
  28. {-#
  29. primVectorSel ::  LispName("prim.vector-sel"), Complexity(1)
  30. primVectorUpdate :: LispName("prim.vector-update"), Complexity(1)
  31. primMakeVector :: LispName("prim.make-vector"), Complexity(4)
  32. primCopyVector :: LispName("prim.copy-vector"), Complexity(5)
  33. strict1 :: Strictness("S,N"),
  34.        LispName("prim.strict1")
  35. primForce :: LispName("prim.force")
  36. #-}
  37.  
  38.